<template>
  <div>
    <el-table
      :data="tableData"
      border
      style="width: 100%">
      <el-table-column
        fixed
        prop="userId"
        label="学号">
      </el-table-column>
      <el-table-column
        prop="college"
        label="学院">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名">
      </el-table-column>
      <el-table-column
        prop="healthy"
        label="健康状况">
      </el-table-column>
      <el-table-column
        prop="temperature"
        label="体温">
      </el-table-column>
      <el-table-column
        prop="goOut"
        label="是否外出">
      </el-table-column>
      <el-table-column
        prop="updateTime"
        label="填报时间"
        width="180px">
      </el-table-column>
      <el-table-column
        prop="work"
        label="工作状态">
      </el-table-column>
      <el-table-column
        prop="remark"
        label="备注">
      </el-table-column>

    </el-table>

    <el-pagination
      background
      layout="prev, pager, next"
      page-size="5"
      :total="total"
      @current-change="page">
    </el-pagination>
  </div>
</template>

<script>
export default {
  methods: {
    handleClick(row) {
      console.log(row);
    },
    page(currentPage){
      const _this = this;
      axios.get('http://localhost:1234/selectHaveClocked/'+ currentPage +'/5').then(function (resp){
        _this.tableData = resp.data;
      })
    }
  },
  created() {
    const _this = this;
    axios.get('http://localhost:1234/selectHaveClocked/1/5').then(function (resp){
      console.log(resp);
      _this.total = resp.data[0].num;
      _this.tableData = resp.data;
    })
  },
  data() {
    return {
      total: null,
      tableData: null
    }
  }
}
</script>
